#ifndef QS_TFT_PROTOCOL_H_
#define QS_TFT_PROTOCOL_H_
#pragma pack(1)
typedef union {
    struct {
        uint16_t lead_code;
        uint8_t len;
        uint8_t type;
        uint16_t cmd;
        uint16_t value;
        uint16_t crc;
    }frame;
    struct {
        uint16_t lead_code;
        uint8_t len;
        uint8_t type;
        uint16_t cmd;
        char temp_data[2];
        uint16_t crc;
    }temp_frame;
    struct {
        uint16_t lead_code;
        uint8_t len;
        uint8_t type;
        uint16_t cmd;
        char time_data[2];
        uint16_t crc;
    }timer_frame;
    struct {
        uint16_t lead_code;
        uint8_t len;
        uint8_t data[1];
    };
    uint8_t raw_daten[1];
}qs_tft_protocol_t;

#pragma pack()

unsigned short qs_tft_CRC16(unsigned char *puchMsg,unsigned short usDataLen);
void qs_tft_protocol_data_send(uint8_t type, uint16_t cmd, uint16_t value);
void qs_tft_protocol_temp_data_send(uint8_t type, uint16_t cmd, int8_t temp);
void qs_tft_protocol_timer_data_send(uint8_t type, uint16_t cmd, uint8_t timer);
void qs_tft_protocol_init(void);
void qs_tft_protocol_data_process(void);



#endif